<template>
  <div id="page-submitSuccess">
    <top-header title='提交成功' :show-right='true' @on-click-right='finish'>
      <template v-slot:right>
        <p class="header-finish">完成</p>
      </template>
    </top-header>
    <img src="static/image/suggestionFeedback/success.png" alt="提交成功" class="submit-icon">
    <p class="submit-msg">信息填写成功，正在为大师派单</p>
    <p class="submit-tip">目前您排队在第<span class="submit-tip-num">{{queue}}</span>位，预计<span class="submit-tip-num">1</span>个工作日之内将答复 </p>

    <div class="submit-form" v-if='userInfo'>
      <div class="submit-form-item">
        <p class="submit-form-title">姓名</p>
        <p class="submit-form-detail">{{userInfo.username}}</p>
      </div>
      <div class="submit-form-item">
        <p class="submit-form-title">性别</p>
        <p class="submit-form-detail">{{userInfo.sex}}</p>
      </div>
      <div class="submit-form-item">
        <p class="submit-form-title">公历生日</p>
        <p class="submit-form-detail">{{userInfo.solarDate}}</p>
      </div>
      <div class="submit-form-item">
        <p class="submit-form-title">农历生日</p>
        <p class="submit-form-detail">{{userInfo.lunarDate}}</p>
      </div>
      <div class="submit-form-item">
        <p class="submit-form-title">出生地</p>
        <p class="submit-form-detail">{{userInfo.address}}</p>
      </div>
      <div class="submit-form-item">
        <p class="submit-form-title">问题补充</p>
        <p class="submit-form-detail">{{userInfo.remarks}}</p>
      </div>
    </div>

    <div class="submit-container" v-if="userInfo">
      <div class="submit-btn" v-if="userInfo.isOrderIn" @click="gotoOrderDetail">查看订单详情</div>   
      <div class="submit-btn" v-else  @click="continueAsk">继续提问</div>
    </div>
  </div>
</template>

<script>
  import topHeader from '@/components/topHeader';

  export default {
    props:[],
    components:{
      topHeader
    },
    data:function(){
      return {
        userInfo: this.$route.query.userInfo,
        queue: undefined,// 排队人数
      }
    },
    created() {
      this.getMasterInfo()
    },
    methods:{
      //点击完成
      finish:function(){
        this.$router.replace('/index')
      },
      // 点击继续提问
      continueAsk:function(){
        this.$router.replace('/askTeacher')
      },
      gotoOrderDetail:function(){
        this.$router.replace('/orderInfo?orderCode='+this.userInfo.ordercode)
      },
      getMasterInfo() {
        let param = {
          mid: this.$route.query.userInfo.mid
        }
        this.$fetch.post('/app/Jmyc/auto_mate_master',param).then((res)=>{
          if(res.code == 200){
            this.queue = res.data.master_info.ordering_num || 1
            console.log('排队人数',res.data.master_info.ordering_num)
          }
        })
     }
    }
  }
</script>

<style lang="less" scoped>
  @import '../../assets/css/public.less';
  @import './index.less';
</style>